#include "def.h"

void InitMap(Graph &G){
	
	ifstream in("map.txt"); 
    in >> G.vertexNum >> G.arcNum;
	
    //初始化顶点表
    for (int i = 0; i < G.vertexNum; i++)
    {
        in>>G.vexs[i].name;
        in>>G.vexs[i].info;
    }
    
	
    for (int i = 0; i < G.vertexNum; i++)
    {
        for (int j = 0; j < G.vertexNum; j++)
        {
            G.arcs[i][j]=INF;
        }
    }


    for (int i = 0; i < G.arcNum; i++)
    {
        int m, n,distance;
        char tname1[MaxSize],tname2[MaxSize];
        in>>tname1;
		in>>tname2;
		in>>distance;

        m=LocateVex(G,tname1);
        n=LocateVex(G,tname2);
		//如果m n为-1，表示输入有错
        if (m==-1 || n==-1)
        {
            cout<<"不存在该景点";
        }
        
        G.arcs[m][n] = distance;
        G.arcs[n][m] = distance;
    }
}